package ${baseInfo.packageName};

import ${baseInfo.packageName?replace(".controller", ".base")}.BaseController;
import ${baseInfo.packageName?replace(".controller", ".annotation")}.StartPage;
import ${tableClass.fullClassName};
import ${vo.packageName}.${vo.fileName};
import ${serviceInterface.packageName}.${serviceInterface.fileName};
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@RestController
@RequestMapping("/${tableClass.shortClassName?uncap_first}")
public class ${baseInfo.fileName} extends BaseController {

    @Autowired
    private ${serviceInterface.fileName} ${serviceInterface.fileName?uncap_first};

    @StartPage
    @PostMapping("/page")
    public List<${vo.fileName}> getVos(@RequestBody ${vo.fileName} vo) {
        return ${serviceInterface.fileName?uncap_first}.getVos(vo);
    }

    @GetMapping("/getById")
    public ${vo.fileName} getById(@RequestParam("id") Long id) {
        return ${serviceInterface.fileName?uncap_first}.getVoById(id);
    }

    @PostMapping("/saveOrUpdate")
    public void saveOrUpdate(@RequestBody ${vo.fileName} vo) {
        ${serviceInterface.fileName?uncap_first}.saveOrUpdateVo(vo);
    }

    @PostMapping("/saveOrUpdateBatch")
    public void saveOrUpdateBatch(@RequestBody List<${vo.fileName}> vos) {
        ${serviceInterface.fileName?uncap_first}.saveOrUpdateVoBatch(vos);
    }

    @DeleteMapping("/delete")
    public void delete(@RequestParam("ids") List<Long> ids) {
        ${serviceInterface.fileName?uncap_first}.removeByIds(ids);
    }

}
